﻿using System;
using SharpSqlAnalyzer.nodes;

namespace SharpSqlAnalyzer.stmt.mysql
{
	// Token: 0x02000150 RID: 336
	public class TMySQLCaseStmt : TCustomMySQLStmt
	{
		// Token: 0x06000B3E RID: 2878 RVA: 0x00305BA6 File Offset: 0x00303DA6
		public TMySQLCaseStmt(EDbVendor dbvendor) : base(dbvendor)
		{
			this.sqlstatementtype = ESqlStatementType.sstmysqlcasestmt;
		}

		// Token: 0x06000B3F RID: 2879 RVA: 0x00305BBA File Offset: 0x00303DBA
		internal override void buildsql()
		{
		}

		// Token: 0x06000B40 RID: 2880 RVA: 0x00305BBC File Offset: 0x00303DBC
		internal override void clear()
		{
		}

		// Token: 0x06000B41 RID: 2881 RVA: 0x00305BBE File Offset: 0x00303DBE
		internal override string getasprettytext()
		{
			return "";
		}

		// Token: 0x06000B42 RID: 2882 RVA: 0x00305BC5 File Offset: 0x00303DC5
		internal override void iterate(TVisitorAbs pvisitor)
		{
		}

		// Token: 0x06000B43 RID: 2883 RVA: 0x00305BC8 File Offset: 0x00303DC8
		public override int doParseStatement(TCustomSqlStatement psql)
		{
			if (this.rootNode == null)
			{
				return -1;
			}
			base.doParseStatement(psql);
			TCaseExpression tcaseExpression = (TCaseExpression)this.rootNode;
			this.expr = tcaseExpression.Input_expr;
			if (this.expr != null)
			{
				this.expr.doParse(this, ESqlClause.unknown);
			}
			this.whenClauseItemList = tcaseExpression.WhenClauseItemList;
			this.whenClauseItemList.doParse(this, ESqlClause.unknown);
			if (tcaseExpression.Else_statement_node_list != null)
			{
				tcaseExpression.Else_statement_node_list.doParse(psql, ESqlClause.unknown);
				for (int i = 0; i < tcaseExpression.Else_statement_node_list.size(); i++)
				{
					this.DefaultStatementList.add(tcaseExpression.Else_statement_node_list.getStatementSqlNode(i).Stmt);
				}
			}
			return 0;
		}

		// Token: 0x1700020D RID: 525
		// (get) Token: 0x06000B44 RID: 2884 RVA: 0x00305C75 File Offset: 0x00303E75
		// (set) Token: 0x06000B45 RID: 2885 RVA: 0x00305C7D File Offset: 0x00303E7D
		public virtual TExpression Expr
		{
			get
			{
				return this.expr;
			}
			set
			{
				this.expr = value;
			}
		}

		// Token: 0x1700020E RID: 526
		// (get) Token: 0x06000B46 RID: 2886 RVA: 0x00305C86 File Offset: 0x00303E86
		// (set) Token: 0x06000B47 RID: 2887 RVA: 0x00305C8E File Offset: 0x00303E8E
		public virtual TWhenClauseItemList WhenClauseItemList
		{
			get
			{
				return this.whenClauseItemList;
			}
			set
			{
				this.whenClauseItemList = value;
			}
		}

		// Token: 0x1700020F RID: 527
		// (get) Token: 0x06000B48 RID: 2888 RVA: 0x00305C97 File Offset: 0x00303E97
		// (set) Token: 0x06000B49 RID: 2889 RVA: 0x00305CB2 File Offset: 0x00303EB2
		public virtual TStatementList DefaultStatementList
		{
			get
			{
				if (this.defaultStatementList == null)
				{
					this.defaultStatementList = new TStatementList();
				}
				return this.defaultStatementList;
			}
			set
			{
				this.defaultStatementList = value;
			}
		}

		// Token: 0x06000B4A RID: 2890 RVA: 0x00305CBB File Offset: 0x00303EBB
		public override void accept(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x06000B4B RID: 2891 RVA: 0x00305CCC File Offset: 0x00303ECC
		public override void acceptChildren(TParseTreeVisitor v)
		{
			v.preVisit(this);
			if (this.expr != null)
			{
				this.expr.accept(v);
			}
			this.whenClauseItemList.accept(v);
			if (this.defaultStatementList != null)
			{
				this.defaultStatementList.accept(v);
			}
			v.postVisit(this);
		}

		// Token: 0x040012AA RID: 4778
		private TExpression expr;

		// Token: 0x040012AB RID: 4779
		private TWhenClauseItemList whenClauseItemList;

		// Token: 0x040012AC RID: 4780
		private TStatementList defaultStatementList;
	}
}
